export const phone = /^1[0-9]{10,10}$/; // 手机正则

export const password = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?![,\.#%'\+\*\-:;^_`]+$)[,\.#%'\+\*\-:;^_`0-9A-Za-z]{8,20}$/; // 密码规则 8-20 至少包含数字、字母、符号中的两种

export const validator = (rule, value, callback) => {
	switch (rule?.type) {
		case 'phone': 
			return phone.test(value);
			break;
		case 'password': 
			return password.test(value);
			break;
	}
	
	return true;
}
